package com.guigu.www.luolujin.Conteoller;

import com.guigu.www.luolujin.Service.LljTemplateFoodService;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.TemplateFood;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 作者 罗露金
 */
@RestController
@RequestMapping("/LljTemplateFoodServlet")
public class LljTemplateFoodServlet {
    @Autowired
    LljTemplateFoodService service;
    @GetMapping()
    public PageVo<TemplateFood> pageTemFood(Integer pageNum, Integer pageSize, String tempFoodName){
        return service.pageTemFood(pageNum, pageSize, tempFoodName);
    }
    @PostMapping
    public void insertTemFood(@RequestBody TemplateFood templateFood){
        service.insertTemFood(templateFood);
    }
    @DeleteMapping("{id}")
    public void deleteTemFood(@PathVariable("id") Integer tempFoodId){
        service.deleteTemFood(tempFoodId);
    }

    @PutMapping
    public void updateTemFood(@RequestBody TemplateFood templateFood){
        service.updateTemFood(templateFood);
    }
    @GetMapping("/queryById")
    public List<TemplateFood> queryById(int foodZongId) {
        return service.queryById(foodZongId);
    }
    @GetMapping("{id}")
    public TemplateFood selectById(@PathVariable("id") Integer tempFoodId) {
        return service.selectById(tempFoodId);
    }
    @PutMapping("/state")
    void upTemFood(Integer tempFoodId, Integer tempFoodState) {
        service.upTemFood(tempFoodId,tempFoodState);
    }
}
